package pl.vanta.utils.commons;

public class TimeUtils
{
	private TimeUtils()
	{
	}

	public static void waitS(int seconds)
	{
		waitMS(seconds * 1000);
	}

	public static void waitMS(int miliseconds)
	{
		if (miliseconds > 0)
		{
			long start = System.currentTimeMillis();

			try
			{
				Thread.sleep(miliseconds);
			}
			catch (InterruptedException e)
			{
				long stop = System.currentTimeMillis();

				if (stop - start < miliseconds)
				{
					waitMS((int) (miliseconds - (stop - start)));
				}
			}
		}
	}
}